package oj.swing.component;

import java.awt.event.ActionListener;

import javax.swing.Action;
import javax.swing.Icon;
import javax.swing.InputMap;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JTextField;
import javax.swing.KeyStroke;


import com.intelap.dx.dataset.DataSet;



public class JButtonLine extends JButton {

  private String           columnName;
  private DataSet          dataSet;

  /* Solo por compatibilidad, no tiene utilidad en el Boton */
  private JTextField field;

  public JButtonLine() {
    super();
    init();
  }

  public JButtonLine(String p0) {
    super(p0);
    init();
  }

  public JButtonLine(Action p0) {
    super(p0);
    init();
  }

  public JButtonLine(Icon p0) {
    super(p0);
    init();
  }

  public JButtonLine(String p0, Icon p1) {
    super(p0, p1);
    init();
  }

  private void init() {
    JTextField field = new JTextField();
  }

  public JTextField getField() {
    return field;
  }

  public void setField(JTextField field) {
    this.field = field;
  }

  public void setColumnName(String columnName) {
    this.columnName = columnName;
  }

  public String getColumnName() {
    return columnName;
  }

  public void setDataSet(DataSet dataSet) {
    this.dataSet = dataSet;
  }

  public DataSet getDataSet() {
    return dataSet;
  }

  //FMF - 03/01/2006 - ShortCut==================//
  public void addHotKeyAction(String key,ActionListener action) {
    JButtonAction buttonAction = new JButtonAction(action);
    if (key != null && !key.trim().equals("")) {
      KeyStroke keystroke = KeyStroke.getKeyStroke(key);
      InputMap map = getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
      map.put(keystroke, "buttonAction");
      getActionMap().put("buttonAction", buttonAction);
    }
    addActionListener(buttonAction);
  }  
  //FMF - 03/01/2006 - ShortCut==================/*/
}